Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

puppeteer-core

Package Overview
Dependencies
Maintainers
2
Versions
246
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puppeteer-core

A high-level API to control headless Chrome over the DevTools Protocol

  • 8.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.3M
decreased by-41.32%
Maintainers
2
Weekly downloads
 
Created

What is puppeteer-core?

The puppeteer-core package is a version of Puppeteer, a Node library which provides a high-level API to control headless Chrome or Chromium over the DevTools Protocol. It is intended to be a lightweight version that can be used when you want to bring your own browser. It does not download any browsers by default, unlike the full puppeteer package.

What are puppeteer-core's main functionalities?

Page Automation

Automate and control a web page, including navigation, screenshot taking, and DOM manipulation.

const puppeteer = require('puppeteer-core');

(async () => {
  const browser = await puppeteer.launch({executablePath: '/path/to/your/Chrome'});
  const page = await browser.newPage();
  await page.goto('https://example.com');
  await page.screenshot({path: 'example.png'});
  await browser.close();
})();

Form Submission

Automate form submissions by typing into fields and clicking buttons.

const puppeteer = require('puppeteer-core');

(async () => {
  const browser = await puppeteer.launch({executablePath: '/path/to/your/Chrome'});
  const page = await browser.newPage();
  await page.goto('https://example.com/login');
  await page.type('#username', 'myUsername');
  await page.type('#password', 'myPassword');
  await page.click('#submit');
  await page.waitForNavigation();
  await browser.close();
})();

Web Scraping

Extract data from web pages by running JavaScript in the context of the page.

const puppeteer = require('puppeteer-core');

(async () => {
  const browser = await puppeteer.launch({executablePath: '/path/to/your/Chrome'});
  const page = await browser.newPage();
  await page.goto('https://example.com');
  const data = await page.evaluate(() => {
    return document.querySelector('h1').textContent;
  });
  console.log(data);
  await browser.close();
})();

PDF Generation

Generate PDFs of web pages for offline viewing or archiving.

const puppeteer = require('puppeteer-core');

(async () => {
  const browser = await puppeteer.launch({executablePath: '/path/to/your/Chrome'});
  const page = await browser.newPage();
  await page.goto('https://example.com', {waitUntil: 'networkidle0'});
  await page.pdf({path: 'example.pdf', format: 'A4'});
  await browser.close();
})();

Automated Testing

Perform automated testing on web applications, including end-to-end tests, performance testing, and more.

const puppeteer = require('puppeteer-core');

(async () => {
  const browser = await puppeteer.launch({executablePath: '/path/to/your/Chrome', headless: false});
  const page = await browser.newPage();
  await page.goto('https://example.com');
  // Perform various tests, like checking if a button exists
  const buttonExists = await page.$('button') !== null;
  console.assert(buttonExists, 'Button should exist on the page');
  await browser.close();
})();

Other packages similar to puppeteer-core

FAQs

Package last updated on 26 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc